package mei

import (
	"encoding/xml"
	"sync"

	"github.com/bububa/opentaobao/model"
)

// TmallMeiCrmMemberSyncPrivyAPIResponse 同步推送会员信息(隐私号版本) API返回值
// tmall.mei.crm.member.sync.privy
//
// 品牌方通过该api主动推送会员信息。使用场景包括
// 1.用户在线上注册后，线下补充信息后，同步到线上。
// 2.其他情况的主动推送变更。
type TmallMeiCrmMemberSyncPrivyAPIResponse struct {
	model.CommonResponse
	TmallMeiCrmMemberSyncPrivyAPIResponseModel
}

// Reset 清空结构体
func (m *TmallMeiCrmMemberSyncPrivyAPIResponse) Reset() {
	(&m.CommonResponse).Reset()
	(&m.TmallMeiCrmMemberSyncPrivyAPIResponseModel).Reset()
}

// TmallMeiCrmMemberSyncPrivyAPIResponseModel is 同步推送会员信息(隐私号版本) 成功返回结果
type TmallMeiCrmMemberSyncPrivyAPIResponseModel struct {
	XMLName xml.Name `xml:"tmall_mei_crm_member_sync_privy_response"`
	// 平台颁发的每次请求访问的唯一标识
	RequestId string `json:"request_id,omitempty" xml:"request_id,omitempty"`
	// 处理的其他信息
	MeiExtraInfo string `json:"mei_extra_info,omitempty" xml:"mei_extra_info,omitempty"`
}

// Reset 清空结构体
func (m *TmallMeiCrmMemberSyncPrivyAPIResponseModel) Reset() {
	m.RequestId = ""
	m.MeiExtraInfo = ""
}

var poolTmallMeiCrmMemberSyncPrivyAPIResponse = sync.Pool{
	New: func() any {
		return new(TmallMeiCrmMemberSyncPrivyAPIResponse)
	},
}

// GetTmallMeiCrmMemberSyncPrivyAPIResponse 从 sync.Pool 获取 TmallMeiCrmMemberSyncPrivyAPIResponse
func GetTmallMeiCrmMemberSyncPrivyAPIResponse() *TmallMeiCrmMemberSyncPrivyAPIResponse {
	return poolTmallMeiCrmMemberSyncPrivyAPIResponse.Get().(*TmallMeiCrmMemberSyncPrivyAPIResponse)
}

// ReleaseTmallMeiCrmMemberSyncPrivyAPIResponse 将 TmallMeiCrmMemberSyncPrivyAPIResponse 保存到 sync.Pool
func ReleaseTmallMeiCrmMemberSyncPrivyAPIResponse(v *TmallMeiCrmMemberSyncPrivyAPIResponse) {
	v.Reset()
	poolTmallMeiCrmMemberSyncPrivyAPIResponse.Put(v)
}
